import { crateActivity, 
    userFindActivity, 
    findActivityById, 
    approvalActivity, 
    releaseActivity, 
    adminFindActivity, 
    coutActivityNumber, countActivityList, outputCountActivity, updateActivity, findActivityAudit,activityTopIndex } from '@/api/activityManager'

const activityManager = {
    actions: {
        // 创建
        CrateActivity({ commit }, data) {
            return new Promise((resolve, reject) => {
                crateActivity(data).then(response => {
                    resolve(response)
                }).catch(error => {
                    reject(error)
                })
            })
        },
         // 修改
         UpdateActivity({ commit }, data) {
            return new Promise((resolve, reject) => {
                updateActivity(data).then(response => {
                    resolve(response)
                }).catch(error => {
                    reject(error)
                })
            })
        },

        // 获取活动审核内容
        FindActivityAudit({ commit }, data) {
            return new Promise((resolve, reject) => {
                findActivityAudit(data).then(response => {
                    resolve(response)
                }).catch(error => {
                    reject(error)
                })
            })
        },
        //用户搜索
        UserFindActivity({ commit }, data) {
            return new Promise((resolve, reject) => {
                userFindActivity(data).then(response => {
                    resolve(response)
                }).catch(error => {
                    reject(error)
                })
            })
        },
        //管理员搜索
        AdminFindActivity({ commit }, data) {
            return new Promise((resolve, reject) => {
                adminFindActivity(data).then(response => {
                    resolve(response)
                }).catch(error => {
                    reject(error)
                })
            })
        },
        // 根据id获取活动
        FindActivityById({ commit }, activityId) {
            return new Promise((resolve, reject) => {
                findActivityById(activityId).then(response => {
                    resolve(response)
                }).catch(error => {
                    reject(error)
                })
            })
        },
        //审核活动
        ApprovalActivity({ commit }, data) {
            return new Promise((resolve, reject) => {
                approvalActivity(data).then(response => {
                    resolve(response)
                }).catch(error => {
                    reject(error)
                })
            })
        },
        //发布活动
        ReleaseActivity({ commit }, data) {
            return new Promise((resolve, reject) => {
                releaseActivity(data).then(response => {
                    resolve(response)
                }).catch(error => {
                    reject(error)
                })
            })
        },
        //活动统计数
        CoutActivityNumber({ commit }, data) {
            return new Promise((resolve, reject) => {
                coutActivityNumber(data).then(response => {
                    resolve(response)
                }).catch(error => {
                    reject(error)
                })
            })
        },
        //活动统计表数据
        CountActivityList({ commit }, data) {
            return new Promise((resolve, reject) => {
                countActivityList(data).then(response => {
                    resolve(response)
                }).catch(error => {
                    reject(error)
                })
            })
        },
        //导出活动统计数据
        OutputCountActivity({ commit }, data) {
            return new Promise((resolve, reject) => {
                outputCountActivity(data).then(response => {
                    resolve(response)
                }).catch(error => {
                    reject(error)
                })
            })
        },

        //置顶活动到首页
        ActivityTopIndex({ commit }, data) {
            return new Promise((resolve, reject) => {
                activityTopIndex(data).then(response => {
                    resolve(response)
                }).catch(error => {
                    reject(error)
                })
            })
        }
    }
}

export default activityManager
